/**
 * 
 */
package Common.Entities;

import java.io.Serializable;

/**
 * This class implements methods and attributes to handle file transfer from CCRMClient to CCRMServer and back
 * @author Ori Ziv
 *
 */
public class ProductPicture implements Serializable {

	private static final long serialVersionUID = 4333620597942226500L;

	private String pictureTitle;
	private String productID;
	private String picturePath;
	private String pictureName;
	private long pictureSize;
	public byte[] picture;
	private int buffer;
	
	public String getPictureTitle() {
		return pictureTitle;
	}

	public void setPictureTitle(String pictureTitle) {
		this.pictureTitle = pictureTitle;
	}

	public String getProductID() {
		return productID;
	}

	public String getPicturePath() {
		return picturePath;
	}

	public void setPicturePath(String picturePath) {
		this.picturePath = picturePath;
	}

	public long getPictureSize() {
		return pictureSize;
	}

	public void setPictureSize(int pictureSize) {
		this.pictureSize = pictureSize;
	}

	public byte[] getPicture() {
		return picture;
	}
	
	public byte getPictureByte(int i) {
		return picture[i];
	}

	public void setPicture (byte[] picture) {
		for (int i = 0 ; i < this.picture.length ; i ++)
			this.picture[i] = picture[i];
	}
	
	public int getBuffer() {
		return buffer;
	}

	public String getPictureName() {
		return pictureName;
	}

	public void setPictureName(String pictureName) {
		this.pictureName = pictureName;
	}

	/**
	 * @param pictureTitle - picture's title
	 * @param picturePath - picture's absolute path
	 * @param pictureSize - picture's size in bytes
	 */
	public ProductPicture(String productID, String pictureTitle, String picturePath,
			int pictureSize) {
		super();
		this.productID = productID;
		this.pictureTitle = pictureTitle;
		this.picturePath = picturePath;
		this.pictureSize = pictureSize;
		
		buffer = (int) pictureSize;
		this.picture = new byte[buffer];
	}
	
	
}
